package cn.t.enums.order;


import cn.t.core.enums.Enumer;
import cn.t.core.enums.base.CommonEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Enumer
@Getter
@AllArgsConstructor
public enum WorkOrderTypeEnum implements CommonEnum<Integer, String> {
    QUALITY_CHECK(1, 3, "质检"),
    //过期
    EXPIRED(-1, -1,"已过期"),
    PICK(2, 1, "领料"),
    CHANGE(3, 4, "换货"),
    RETURN(4, 5, "退货"),
    REPLENISH(5, 2, "补货"),
    EXCHANGE(6, 6, "旧换新"),
    URGENT_PICK(7, 7, "紧急领料");

    private Integer code;
    private int codeInDto;
    private String name;

    public static WorkOrderTypeEnum getWorkOrderType(int code){
        return Arrays.stream(WorkOrderTypeEnum.values()).filter(f -> f.getCode().equals(code)).findFirst().orElse(PICK);
    }
}
